#ifndef STRAY_RESOURCE_ZIP_FILE
#define STRAY_RESOURCE_ZIP_FILE

#include <File/FileStream.h>
#include <SmartPtr\SharedPtr.h>
#include "../ArchiveFile.h"
#include "Zip.h"

namespace Stray {
namespace Resource {

class ZipFile : public ArchiveFile
{
	typedef Stray::String String;
public:
	ZipFile(const String& archiveFileName);
	~ZipFile();

	Stray::Bool isValid() const;
	FileList getFileList() const;
	ResFilePtr getFile(const String& fileName) const;
private:
	String name_;
	mutable Stray::Core::FileStream fs_;
	Stray::Bool isValid_;

	void getZipDirHeader(ZipDirHeader& dirHeader) const;
	
	struct FileHeaderAndName
	{
		ZipDirFileHeader fileHeader_;
		String fileName_;
	};

	typedef Stray::SharedPtr<FileHeaderAndName>::type FileHeaderAndNamePtr;
	typedef Stray::Vector<FileHeaderAndNamePtr>::type FileHeaderAndNameList;

	FileHeaderAndNameList getZipDirFileHeaderAndNameList() const;
};

}
}

#endif